package cn.sdhuijin.model;

import cn.sdhuijin.utils.PropertiesUtil;

/**
 * @author sunp@sdhuijin.cn
 * @version 创建时间：2015年1月29日 上午9:48:13 类说明
 */
public class FTP {
	private String ftp;
	private int port;
	private String ftpDir;
	private String name;
	private String password;

	public void load() {
		String fileName = "ftp.properties";
		this.ftp = PropertiesUtil.GetValueByKey(fileName, "ftp");
		this.port = Integer.parseInt(PropertiesUtil.GetValueByKey(fileName,
				"port"));
		this.ftpDir = PropertiesUtil.GetValueByKey(fileName, "ftpDir");
		this.name = PropertiesUtil.GetValueByKey(fileName, "name");
		this.password = PropertiesUtil.GetValueByKey(fileName, "password");
	}

	public void write() throws Exception {
		String fileName = "ftp.properties";
		PropertiesUtil.WriteProperties(fileName, "ftp", this.ftp);
		PropertiesUtil.WriteProperties(fileName, "port",
				String.valueOf(this.port));
		PropertiesUtil.WriteProperties(fileName, "ftpDir", this.ftpDir);
		PropertiesUtil.WriteProperties(fileName, "name", this.name);
		PropertiesUtil.WriteProperties(fileName, "password", this.password);
	}

	/**
	 * @return the ftp
	 */
	public String getFtp() {
		return ftp;
	}

	/**
	 * @param ftp
	 *            the ftp to set
	 */
	public void setFtp(String ftp) {
		this.ftp = ftp;
	}

	/**
	 * @return the port
	 */
	public int getPort() {
		return port;
	}

	/**
	 * @param port
	 *            the port to set
	 */
	public void setPort(int port) {
		this.port = port;
	}

	/**
	 * @return the ftpDir
	 */
	public String getFtpDir() {
		return ftpDir;
	}

	/**
	 * @param ftpDir
	 *            the ftpDir to set
	 */
	public void setFtpDir(String ftpDir) {
		this.ftpDir = ftpDir;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name
	 *            the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the password
	 */
	public String getPassword() {
		return password;
	}

	/**
	 * @param password
	 *            the password to set
	 */
	public void setPassword(String password) {
		this.password = password;
	}

}
